package com.letv.android.client.view;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.widget.TextView;

import com.letv.android.young.client.R;

public class LoadingDialog extends ProgressDialog {

    private int msgId;
    private String msgText;

    public LoadingDialog(Context context, int msgId) {
        super(context, R.style.LoadingDialog_Fullscreen);
        this.msgId = msgId;
    }

    public LoadingDialog(Context context, String msgText) {
        super(context, R.style.LoadingDialog_Fullscreen);
        this.msgText = msgText;
    }

    public LoadingDialog(Context context, int msgId, boolean isFull) {
        super(context, isFull ? R.style.Dialog_Fullscreen : R.style.LoadingDialog_Fullscreen);
        this.msgId = msgId;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.letv_loadingdialog);
        TextView msg = (TextView) findViewById(R.id.msg);
        if (msgId == 0 && !TextUtils.isEmpty(msgText)) {
            msg.setText(msgText);
        } else {
            msg.setText(msgId);
        }
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return true;
    }
}
